//
//  HRLifeDetailViewController.m
//  Hear
//
//  Created by mac on 2017/9/29.
//  Copyright © 2017年 mac. All rights reserved.
//

#import "HRLifeDetailViewController.h"
#import "HRSearchFunChatFriendViewController.h"
#import "HRShowPowerControlView.h"
@interface HRLifeDetailViewController ()

@end

@implementation HRLifeDetailViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.view.backgroundColor = [UIColor whiteColor];
    [self setupView];
    UIButton *leftButton = [UIButton buttonWithType:0];
    leftButton.frame = CGRectMake(20, 30+kStatusBarHeight, 20, 20);
    [leftButton setImage:[UIImage imageNamed:@"Back-Arrow"] forState:UIControlStateNormal];
    [leftButton addTarget:self action:@selector(clickBack) forControlEvents:UIControlEventTouchUpInside];
    [self.view insertSubview:leftButton aboveSubview:self.view];
    // Do any additional setup after loading the view.
}
- (void)setupView{
    
    UIButton *titleButton = [UIButton buttonWithType:0];
    titleButton.size = CGSizeMake(160, 30);
    [titleButton setTitle:@"模拟人生，匹配互动" forState:0];
    [titleButton setTitleColor:[UIColor whiteColor] forState:0];
    titleButton.titleLabel.font = [UIFont boldSystemFontOfSize:17];
    self.navigationItem.titleView = titleButton;

    
    UIImageView *backImageView = [UIImageView new];
    backImageView.image = [UIImage imageNamed:@"FunChat_背景"];
    backImageView.userInteractionEnabled = YES;
    backImageView.contentMode = UIViewContentModeScaleAspectFill;
    [self.view addSubview:backImageView];
    backImageView.frame = self.view.bounds;
    
    CGFloat leftPading = 20;
    CGFloat topWidth = 335;
    UIView *topView = [[UIView alloc] initWithFrame:CGRectMake((kFullWidth-topWidth)/2, leftPading+kNavBarHeight,topWidth , topWidth-50)];
    topView.backgroundColor = [UIColor clearColor];
    [self.view addSubview:topView];
    topView.layer.cornerRadius = 6;
    topView.layer.shadowRadius      = 3;
    topView.layer.shadowOpacity     = 0.2;
    topView.layer.shadowOffset      = CGSizeMake(2, 2);
    topView.layer.shadowPath        = [UIBezierPath bezierPathWithRect:topView.bounds].CGPath;
    
    UIImageView *topImageView = [UIImageView new];
    topImageView.image = [UIImage imageNamed:@"lifeDetail"];
    topImageView.contentMode = UIViewContentModeScaleToFill;
    [topView addSubview:topImageView];
    topImageView.frame = CGRectMake(0, 0, topView.width, topView.height-70);
    
    
    CGFloat buttonWidth = (topView.width-leftPading*4)/2;
    NSArray *textArr = @[@"查看详情",@"立即匹配"];
    for (int i =0; i <textArr.count; i ++) {
        UIButton *button = [UIButton buttonWithType:0];
        button.tag = i;
        [button setTitle:textArr[i] forState:0];
        [button setTitleColor:[UIColor whiteColor] forState:0];
        button.titleLabel.font = CustomUIFont(15);
        [button addTarget:self action:@selector(buttonClick:) forControlEvents:UIControlEventTouchUpInside];
        [topView addSubview:button];
        button.layer.borderWidth = 1;
        button.layer.cornerRadius = 5;
        button.clipsToBounds = YES;
        if (i==0){
            button.frame = CGRectMake(leftPading, topImageView.bottom+15, buttonWidth, 40);
            button.layer.borderColor = [[UIColor whiteColor] CGColor];
        }else{
            button.frame = CGRectMake(leftPading+(buttonWidth+leftPading*2), topImageView.bottom+15, buttonWidth, 40);
            button.layer.borderColor = [MainColor CGColor];
            [button setTitleColor:MainColor forState:0];
        }
    }
}

- (void)buttonClick:(UIButton *)button{
    if (button.tag == 0){
        [HRShowPowerControlView showPowerControlView:@"模拟人生游戏提示" andContent:@"Hearer将为你匹配同样想参与模拟情感互动的异性。演绎的主题、场景与时间等，由双方自行沟通约定，形式不限，内容不限，但建议以双方都熟悉的场景或体验开始。互动过程中，男生请积极主动，更多地照顾女生哟。\rHearer倡导健康积极的互动。为避免双方陷入虚拟情感中，模拟互动以不超过1天为佳。另外，本游戏不涉及金钱往来，如发现对方有违规或骚扰行为，请保留截屏证据并向Hearer举报。" showImageName:@"聊天弹框-图片" andBtnArr:@[@"我知道了"]];
    }else{
        HRSearchFunChatFriendViewController *searchVC = [HRSearchFunChatFriendViewController new];
        searchVC.TopicLocalId = self.TopicLocalId;
        [self.navigationController pushViewController:searchVC animated:YES];
    }
}

- (void)clickBack{
    [self.navigationController popViewControllerAnimated:YES];
}

-(void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
}


-(void)viewWillDisappear:(BOOL)animated{
    [super viewDidDisappear:animated];
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}



@end
